home *** CD-ROM | disk | FTP | other *** search
- /*
- * CREATEBORDER.C
- */
-
- #include "newlook.h"
-
- struct Border *CreateBorder(x,y,w,h,pn)
- SHORT x,y,w,h;
- BOOL pn; /* FALSE=positive, TRUE=negative */
- {
- struct Border *tl, *br; /* TopLeft, BottomRight */
- SHORT *xy;
-
- ULONG UserHandle= SetNewLookHandle(PRIVATE_HANDLE);
-
- if(tl= (struct Border *)SmartAllocate(BORDERSIZE))
- {
- if(br= (struct Border *)SmartAllocate(BORDERSIZE))
- {
- if(xy= (SHORT *)SmartAllocate(2*BORDERXYSIZE))
- {
- --w;
- --h;
-
- /* shining edges */
- xy[0]= w-1; xy[1]= 0; /* ++++++++++++ */
- xy[2]= 0; xy[3]= 0; /* ++ */
- xy[4]= 0; xy[5]= h; /* ++ */
- xy[6]= 1; xy[7]= h-1; /* ++ */
- xy[8]= 1; xy[9]= 1; /* + */
-
- /* shadow edges */
- xy[10]= 1; xy[11]= h; /* + */
- xy[12]= w; xy[13]= h; /* ++ */
- xy[14]= w; xy[15]= 0; /* ++ */
- xy[16]= w-1; xy[17]= 1; /* ++ */
- xy[18]= w-1; xy[19]= h-1; /* ++++++++++++ */
-
- /* top, left (shining) border */
- tl->LeftEdge = x;
- tl->TopEdge = y;
- tl->FrontPen = pn ? 1:2;
- tl->BackPen = 0;
- tl->DrawMode = JAM1;
- tl->Count = 5;
- tl->XY = &xy[0];
- tl->NextBorder = br;
-
- /* bottom, right (shadow) border */
- br->LeftEdge = x;
- br->TopEdge = y;
- br->FrontPen = pn ? 2:1;
- br->BackPen = 0;
- br->DrawMode = JAM1;
- br->Count = 5;
- br->XY = &xy[10];
- br->NextBorder = (struct Border *)NULL;
-
- MakePrivateHandlePublic(UserHandle);
- return(tl);
- }
- }
- }
- if(UserHandle != PRIVATE_HANDLE)
- { SmartFreeAll(PRIVATE_HANDLE);
- (void)SetNewLookHandle(UserHandle);
- }
- return (struct Border *)NULL;
- }
-